package com.cskaoyan.controller;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.User;
import com.cskaoyan.bean.UserData;
import com.cskaoyan.bean.param.BaseParam;
import com.cskaoyan.service.UserService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author stone
 * @date 2022/01/06 16:23
 */
@RestController
public class UserController {

    @Autowired
    UserService userService;

    @RequestMapping("admin/user/list")
    @RequiresPermissions(value = "admin:user:list",logical = Logical.OR)
    public BaseRespVo userList(String username,BaseParam param) {
        UserData userData = userService.query(param,username);
        return BaseRespVo.ok(userData);
    }

    /*@GetMapping("admin/user/insert")
    public BaseRespVo insert(User user) {
        return BaseRespVo.ok(null);
    }*/
    @PostMapping("admin/user/insert")
    public BaseRespVo insert2(@RequestBody User user) {
        return BaseRespVo.ok(null);
    }
}
